import java.awt.Color;
import java.awt.Point;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.LinkedList;



public class TestServer {
  
	public LinkedList<LinkedList> FileList = new LinkedList<LinkedList>();
	
	  
public static void main(String[] args){
	
	TestServer test= new  TestServer();
	
	for(int i = 0; i < 5; i++){
		
		LinkedList<ShapeObject> tempList = new LinkedList<ShapeObject>();
		int sx = i*10; int sy = i*10;
		int ex = i*10 + 50; int ey = i*10 + 50;
		
		tempList.add(new RectangleObject(new Point(sx,sy), new Point(ex,ey), Color.blue));
		tempList.add(new OvalObject(new Point(sx + 50,sy), new Point(ex + 50,ey), Color.green));
		tempList.add(new LineObject(new Point(sx,sy + 50), new Point(ex,ey + 50), Color.green));
		ObjectOutputStream oos;
		String fileName = "Drawings/testFile"+i+".ser";
		try{
			oos = new ObjectOutputStream(new FileOutputStream(fileName));
		    oos.writeObject(tempList);
		    oos.close();
		}catch(FileNotFoundException fnfe){
			System.out.println("FileNotFoundException"); 
		}catch(IOException ioe){
			System.out.println("IOException");
		}
//		test.FileList.add(tempList);
	}
	File dir = new File("Drawings");
	String[] filenames = dir.list();
	for(String s: filenames){
		System.out.println(s);
	}
	
//	Object tobj = new TestObject();
//	((TestObject)tobj).printStr();
//	ObjectOutputStream oos;
//	String fileName = "Drawings/DrawingFiles.ser";
//	try{
//		oos = new ObjectOutputStream(new FileOutputStream(fileName));
//	    oos.writeObject(test.FileList);
//	    oos.close();
//	}catch(FileNotFoundException fnfe){
//		System.out.println("FileNotFoundException"); 
//	}catch(IOException ioe){
//		System.out.println("IOException");
//	}

}	
}
